package com.lagou.edu.controller;

import com.lagou.edu.MailService;
import com.lagou.edu.service.CodeService;
import org.apache.dubbo.config.annotation.Reference;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/code")
public class CodeController {

    @Autowired
    CodeService codeService;

    @Reference
    MailService mailService;

    /**
     * @Description: 获取验证码
     * http://localhost:8081/code/getCode?email=18895322965@163.com
     * @Author: chendong
     * @Date: 2021/2/3
     **/
    @GetMapping("/getCode/{email}")
    public boolean getCode(@PathVariable String email){
        return codeService.getCode(email);
    }


    @GetMapping("/dubbo")
    public String testDubbo(){
        return mailService.testDubbo();
    }
}
